run_system_wrapper module

Module containing the utility function run_system, which handles a lot of things by analysing the passed kwargs

binarycpython.utils.run_system_wrapper.run_system(**kwargs)[source]

Function that runs a system. Mostly as a useful utility function that handles all the setup of argument lists etc.

Examples

  • run_system(M_1=10): will run a system with ZAMS mass 1 = 10

  • run_system(M_1=10, log_filename=”~/example_log.txt”): Will run a system

    and write the log file too

  • run_system(M_1=10, parse_function=fancy_parsing_function)

Tasks:
  • TODO: Notify user when an unknown keyword is passed.

  • TODO: Centralise the input checking routines here, abstract them and have the population object and this one use the same

All the arguments known to binary_c can be passed to this function as kwargs. Several extra arguments can be passed through the kwargs:

Kwargs:
custom_logging_code: Should contain a string containing the c-code for the shared library.

If this is provided binary_c will use that custom logging code to output its data

log_filename: Should contain name of the binary_c system log file.

Passing this will make sure that the filename gets written for a run (its default behaviour is NOT to write a log file for a system)

parse_function (function): should contain a function that parses the output.

The parse function should take 1 required parameter: the output of the binaryc run Passing this will call the parse_function by passing it the output of the binary_c call and returns what the parse_function returns

Returns

Either returns the raw output of binary_c, or the output of a parse_function if parse_function is given